package org.example.servicepay.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 支付宝支付配置属性
 */
@Data
@Component
@ConfigurationProperties(prefix = "alipay")
public class AlipayProperties {
    
    /**
     * 支付宝网关地址
     */
    private String gatewayUrl = "https://openapi.alipay.com/gateway.do";
    
    /**
     * 应用ID
     */
    private String appId;
    
    /**
     * 应用私钥
     */
    private String privateKey;
    
    /**
     * 支付宝公钥
     */
    private String alipayPublicKey;
    
    /**
     * 签名类型
     */
    private String signType = "RSA2";
    
    /**
     * 字符集
     */
    private String charset = "UTF-8";
    
    /**
     * 数据格式
     */
    private String format = "json";
    
    // 为了匹配YML中的kebab-case命名，添加setter方法
    public void setAppId(String appId) {
        this.appId = appId;
    }
    
    public void setPrivateKey(String privateKey) {
        this.privateKey = privateKey;
    }
    
    public void setAlipayPublicKey(String alipayPublicKey) {
        this.alipayPublicKey = alipayPublicKey;
    }
    
    public void setSignType(String signType) {
        this.signType = signType;
    }
    
    public void setCharset(String charset) {
        this.charset = charset;
    }
    
    public void setFormat(String format) {
        this.format = format;
    }
    
    public void setGatewayUrl(String gatewayUrl) {
        this.gatewayUrl = gatewayUrl;
    }
}